package utils;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by Gipxy group
 * Date: 3/13/12
 */
public class ImageUtil {
    public static byte[] toByte(String imgFileName) {
        return toByte(ImageUtil.class.getResourceAsStream("../data/image/" + imgFileName));
    }
    public static byte[] toByte(InputStream is) {
        try {
            return IOUtils.toByteArray(is);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }

    public static byte[] getOneLargeImage() {
        return toByte(ImageUtil.class.getResourceAsStream("../data/image/compressed_air_main.jpg"));
    }

    public static byte[] getOneRelatedImage() {


        return toByte(ImageUtil.class.getResourceAsStream("../data/image/sl_low_flow_air_knives_100x100.png"));
    }
}
